#include<stdlib.h>
#include<stdio.h>
#include"tree.h"

int tree_insert(struct Node ** node,int value)
{
	if(*node == NULL)
	{
		struct Node * current = malloc(sizeof(struct Node));
		if(current == NULL)
			return -1;
		current->data = value;
		current->left = NULL;
		current->right = NULL;
		*node = current;
		return 0;
	}
	else if(value <= (*node)->data)
		tree_insert(&(*node)->left,value);
	else
		tree_insert(&(*node)->right,value);
}
int * tree_find(struct Node * node,int tmp)
{
	if(node == NULL)
		return NULL;
	if(tmp == node->data)
		return &node->data;
	if (tmp < node->data)
		tree_find(node->left,tmp);       //到左边去找
	if (tmp > node->data)
		tree_find(node->right,tmp);       //到右边去找
}